20. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2024-03-04 14:38:23 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

20.1 Files compared

#LocationFileLast Modified
1/Users/coca/Documents/www/Porto v4.0.2/Theme Files/Magento 2.x/Porto Theme v4.0.7/app/code/Smartwave/FilterproductsFeaturedList.php2020-03-13 09:43:56 +0000
22024-03-04 14:38:23 +0000

20.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged00
Changed00
Inserted00
Removed198

20.3 Comparison options

WhitespaceConsecutive whitespace is treated as a single space
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersNot shown in the comparison detail
Active line-pairing rules

20.4 Active regular expressions

No regular expressions were active.

20.5 Comparison detail

1 <?php    
2     
3 namespace Smartwave\Filterproducts\Block;    
4     
5 class FeaturedList extends \Magento\Catalog\Block\Product\AbstractProduct {    
6     
7     protected $_catalogProductVisibility;    
8     
9     protected $_productCollectionFactory;    
10     
11     protected $_categoryFactory;    
12     
13     protected $urlHelper;    
14     
15     public function __construct(    
16         \Magento\Catalog\Block\Product\Context $context,    
17         \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,    
18         \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility,    
19         \Magento\Catalog\Model\CategoryFactory $categoryFactory,    
20         \Magento\Framework\Url\Helper\Data $urlHelper,    
21         array $data = []    
22     ) {    
23         $this->_categoryFactory = $categoryFactory;    
24         $this->_productCollectionFactory = $productCollectionFactory;    
25         $this->_catalogProductVisibility = $catalogProductVisibility;    
26         $this->urlHelper = $urlHelper;    
27     
28         parent::__construct($context, $data);    
29     }    
30     
31     public function getProducts() {    
32         $count = $this->getProductCount();    
33         $category_id = $this->getData("category_id");    
34         $collection = $this->_productCollectionFactory->create();    
35         $collection->setVisibility($this->_catalogProductVisibility->getVisibleInCatalogIds());    
36     
37         $collection = $this->_addProductAttributesAndPrices($collection)->addStoreFilter();    
38     
39         if(!$category_id) {    
40             $category_id = $this->_storeManager->getStore()->getRootCategoryId();    
41         }    
42         $category = $this->_categoryFactory->create()->load($category_id);    
43         if(isset($category) && $category) {    
44             $collection->addMinimalPrice()    
45                 ->addFinalPrice()    
46                 ->addTaxPercents()    
47                 ->addAttributeToSelect('name')    
48                 ->addAttributeToSelect('image')    
49                 ->addAttributeToSelect('small_image')    
50                 ->addAttributeToSelect('thumbnail')    
51                 ->addAttributeToSelect($this->_catalogConfig->getProductAttributes())    
52                 ->addUrlRewrite()     
53                 ->addAttributeToFilter('sw_featured', 1, 'left')    
54                 ->addCategoryFilter($category);    
55         } else {    
56             $collection->addMinimalPrice()    
57                 ->addFinalPrice()    
58                 ->addTaxPercents()    
59                 ->addAttributeToSelect('name')    
60                 ->addAttributeToSelect('image')    
61                 ->addAttributeToSelect('small_image')    
62                 ->addAttributeToSelect('thumbnail')    
63                 ->addAttributeToSelect($this->_catalogConfig->getProductAttributes())    
64                 ->addUrlRewrite()     
65                 ->addAttributeToFilter('sw_featured', 1, 'left');    
66         }    
67     
68         $collection->getSelect()    
69             ->order('rand()')    
70             ->limit($count);    
71     
72         return $collection;    
73     }    
74     
75     public function getAddToCartPostParams(\Magento\Catalog\Model\Product $product)    
76     {    
77         $url = $this->getAddToCartUrl($product);    
78         return [    
79             'action' => $url,    
80             'data' => [    
81                 'product' => $product->getEntityId(),    
82                 \Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED =>    
83                     $this->urlHelper->getEncodedUrl($url),    
84             ]    
85         ];    
86     }    
87     
88     public function getLoadedProductCollection() {    
89         return $this->getProducts();    
90     }    
91     
92     public function getProductCount() {    
93         $limit = $this->getData("product_count");    
94         if(!$limit)    
95             $limit = 10;    
96         return $limit;    
97     }    
98 }